
package cn.lizheng.web;

import cn.lizheng.dao.AdmininfoDAO;
import cn.lizheng.dao.AdmininfoDAOImpl;
import cn.lizheng.pojo.Admininfo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@WebServlet("/edit")
public class edit extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        AdmininfoDAO dao=new AdmininfoDAOImpl();
        String idStr=req.getParameter("adminid");
        //字符串转整数
        int id= Integer.parseInt(idStr);
        List<Admininfo> alist=dao.get(id);
        //携带参数到页面
        req.setAttribute("admin",alist);
        //页面跳转
        req.getRequestDispatcher("update.jsp").forward(req,resp);
        System.out.println("alist = " + alist);
    }
}
